package com.example.shopspring.interceptor;

import com.example.shopspring.common.ApiConstant;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebAuthConfig implements WebMvcConfigurer {

    @Resource
    AuthInterceptor authInterceptor;

   public void addInterceptors(InterceptorRegistry registry) {
       registry.addInterceptor(authInterceptor)
               .addPathPatterns("/**")
               .excludePathPatterns(ApiConstant.API_VERSION+"/admin/login");
    }

}
